/*
 * @Author: wangtao
 * @Date: 2020-08-20 14:07:42
 * @LastEditors: kanglang
 * @LastEditTime: 2021-02-04 15:29:49
 * @Description:
 */

import React from 'react';
import { View, StyleSheet, Image, Text } from 'react-native';
import { iconFailure, iconWaitingCoffee } from '@/images';
import { Button } from '@/common';
import {
  px2dp,
  fontColorBlack,
  fontColorCoffee,
  fontColorSecDeepGray,
  mainBgColorWhite,
  screenWidth,
} from '@/styles';

const { Submit } = Button;

export default class FeedBackDriverCer extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      status: 0, // 0 失败  1 等待
      title: '',
      desc: '',
    };
  }

  componentDidMount() {

  }

  componentWillUnmount() {
  }

  render() {
    const { status, title, desc, onChange, subDesc } = this.props;
    return (
      <View style={styles.container}>
        <Image
          source={status ? iconWaitingCoffee : iconFailure}
          resizeMode='stretch'
          style={styles.img}
        />
        <Text style={styles.title}>{title}</Text>
        {desc && <Text style={styles.desc}>{desc}</Text>}
        {subDesc && <View style={styles.subDesc}>{subDesc}</View>}
        {!status && (
          <Submit
            text='重新认证'
            onClick={() => {
              onChange();
            }}
            boxStyle={styles.boxStyle}
            btnTextStyle={{
              fontSize: px2dp(28),
            }}
          />
        )}
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    width: screenWidth,
    // minHeight:screenHeight-px2dp(300),
    flex: 1,
    alignItems: 'center',
    backgroundColor: mainBgColorWhite,
  },
  img: {
    width: px2dp(294),
    height: px2dp(294),
    marginTop: px2dp(35),
  },
  title: {
    fontSize: px2dp(40),
    color: fontColorBlack,
    fontWeight: 'bold',
  },
  desc: {
    fontSize: px2dp(28),
    marginTop: px2dp(12),
    color: fontColorSecDeepGray,
    width: px2dp(480),
    textAlign: 'center'
  },
  subDesc: {
    fontSize: px2dp(28),
    width: px2dp(480),
    marginTop: px2dp(12),
  },
  boxStyle: {
    width: px2dp(520),
    height: px2dp(80),
    borderWidth: 1,
    borderColor: fontColorCoffee,
    borderRadius: px2dp(8),
    marginTop: px2dp(64),
  }
});
